package com.ruoyi.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.eic.framework.core.service.ServicePlusImpl;
import com.ruoyi.system.domain.dao.SysPost;
import com.ruoyi.system.mapper.SysPostMapper;
import com.ruoyi.system.mapper.SysUserPostMapper;
import com.ruoyi.system.service.ISysPostService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 岗位信息Service业务层处理
 *
 * @author 尹国春
 * @date 2022-07-25
 */
@Service
public class SysPostServiceImpl extends ServicePlusImpl<SysPostMapper,SysPost> implements ISysPostService
{
    @Autowired
    private SysPostMapper postMapper;

    @Autowired
    private SysUserPostMapper userPostMapper;


    /**
     * 根据用户ID获取岗位选择框列表
     * 
     * @param userId 用户ID
     * @return 选中岗位ID列表
     */
    private static String existSqlUserId="post_id in (select post_id from sys_user_post where user_id={0})";
    @Override
    public List<SysPost> selectPostListByUserId(String userId)
    {

        LambdaQueryWrapper wrapper= Wrappers.<SysPost>lambdaQuery().apply(existSqlUserId,userId);
        return list(wrapper);
    }

}
